#计算圣遗物分数
import json

with open('data\\role.json') as f:
    data = json.load(f)

#通用双爆
ty = data['ty']

#防御为主
fy = data['fy']

#元素充能
yscn = data['yscn']

#元素精通
ysjt = data['ysjt']

#生命值
smz = data['smz']

#奶妈
nm = data['nm']

#赋予基础分
def ty_role(role,ct):
    if str(role) in ty:
        if ct == '攻击力百分比' or ct[1:-1] == '元素伤害加' or ct == '暴击率':
            return 15
        elif ct == '暴击伤害':
            return 13
        elif ct == '生命值百分比':
            return 5
        else:
            return 0

    elif str(role) in yscn:
        if ct == '元素充能效率' or ct[1:-1] == '元素伤害加' or ct == '暴击率' or ct == '攻击力百分比' or ct == '暴击伤害':
            return 10
        else:
            return 0

    elif str(role) in fy:
        if ct == '防御力百分比' or ct[1:-1] == '元素伤害加' or ct == '暴击率' or ct == '攻击力百分比' or ct == '暴击伤害':
            return 15
        elif ct == '元素精通' or ct == '元素充能效率':
            return 10
        else:
            return 0

    elif str(role) in ysjt:
        if ct == '元素精通' or   ct == '攻击力百分比':
            return 15
        elif ct[1:-1] == '元素伤害加' or ct == '暴击率' or ct == '暴击伤害':
            return 8
        elif ct == '生命值百分比':
            return 5
        else:
            return 0

    elif str(role) in smz:
        if ct == '生命值百分比' or ct == '暴击率' or ct == '暴击伤害' or ct == '元素精通' or ct == '攻击力百分比' :
            return 15
        elif ct == '元素充能效率' or ct == '生命值':
            return 10
        else:
            return 0

    elif str(role) in nm:
        if ct == '生命值百分比' or ct == '暴击率' or ct == '暴击伤害' or ct == '元素精通' or   ct == '攻击力百分比' or ct == '元素充能效率' or '治疗加成':
            return 15
        else:
            return 0

    else:
        return 0

#print(ty_role(10000002,'冰元素伤害加成'))

#基本评分
def sc(role_id,name,score_):
    score = 0
    try:
        if name == '暴击率':
            if str(role_id) in smz or str(role_id) in nm:
                score = 0
            else:
                score = score + (score_ * 2)

        if name == '暴击伤害':
            if str(role_id) in smz or str(role_id) in nm:
                score = 0
            else:
                score = score + score_

        if name == '攻击力百分比':
            if str(role_id) in ty:
                score = score + (score_ * 1.33)
            else:
                score = score + (score_ * 0.75)

        if name == '元素充能效率':
            if str(role_id) in yscn:
                score = score + (score_ * 1.08)

            else:
                score = score + (score_ * 0.66)

        if name == '攻击力':
            score = score + (score_ * 0.016)

        if name == '元素精通':
            if str(role_id) in ysjt:
                score = score +(score_*0.66)
            if str(role_id) in smz:
                score = score +(score_*0.25)
            if str(role_id) == "10000022":#22温迪
                score = score + (score_ * 0.25)
            else:
                pass

        if name == '防御力':
            if str(role_id) in fy:
                score = score + (score_ * 0.16)
            else:
                pass

        if name == '防御力百分比':
            if str(role_id) in fy:
                score = score + (score_ * 1.33)
            else:
                pass

        if name == '生命值':
            if str(role_id) in smz:
                score = score + (score_ * 0.016)
            else:
                pass

        if name == '生命值百分比':
            if str(role_id) in smz:
                score = score + (score_ * 1.33)
            else:
                pass

    except:
        pass
    return score